import GCJ_CLASS_TYPE = require('./../../common/GCJ_CLASS_TYPE');
import Serializer = require('./Serializer')

export  = ObjConstrain;

/**
 *
 * @author 
 *
 */
class ObjConstrain extends Serializer{
    public scale = 1; // 0no 1yes 是否可缩放
    public whratio = 1;// 0no 1yes 是否可以改变宽高比[此参数暂时无用]
	public constructor() {
        super();
        this.ct = GCJ_CLASS_TYPE.CLASS_TYPE_ObjConstrain;
	}
	
    // 从json对象(注意不是json字符串)中解析
    public fromJson(jsonObj, versionId) { 
        super.fromJson(jsonObj,versionId);
                
        this.scale = jsonObj.scale;
        this.whratio = jsonObj.whratio;

    }
    // 转成json字符串
    public toJson():string {
        // 去掉父json字符串的头尾
        var superJson = super.toJson();
        superJson = superJson.substr(1,superJson.length-2);
                
        var ret = '{';
            ret +=superJson;
                        
            // scale
            ret +=',';
            ret += '"scale":';
            ret += this.scale;
            // whratio
            ret +=',';
            ret += '"whratio":';
            ret += this.whratio;
            
                        
            ret+='}';
            return ret;
        }
//SJG_MARK_APPEND--------------------


}//SJG_MARK_END-------------------------